package com.hspedu.newData.dmsxl.数组;
/**
 * @Author: yh
 * @description: 
 * @CreateTime: 2025-05-21 
 * @Version: 1.0
 */

public class LC258各位相加 {

    public int addDigits(int num) {

        while (true){
            int sum = 0;
            while (num > 0){
                sum += num%10;
                num /= 10;
            }
            if (sum<10){
                return sum;
            }
            num = sum;
        }
    }
}
